<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'north',border:false">
		<form class="appForm">
			<div class="datagrid-toolbar">
				<table class="appTable">
					<tr>
						<td>
							<input name="Q_name_like" data-options="prompt:'标签名'" class="easyui-textbox" type="text" style="width:100px;"/>
							<button type="submit" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</button>
							<button type="button" onclick="$(this).parents('form').eq(0).form('reset');" class="easyui-linkbutton" data-options="iconCls:'icon icon-reset'">清空</button>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div data-options="region:'center',border:false">
		<table id="dddddd" class="appGrid"></table>
	</div>
	DSAF
	SDAFDSF
</div>
<script type="text/javascript">
	var grids = $("table.appGrid");
	$("#dddddd").datagrid({
		id:'dg',
		url:_ctx+'/admin/label/list',
		multiSort:false,
		sortName:'create_time',
		sortOrder:'desc',
		columns:[[
			{field:'id',checkbox:true},
			{field:'name',title:'标签名',width:100,sortable:true},
			{field:'login_name',title:'创建人',width:100,sortable:true},
			{field:'create_time',title:'创建时间',width:80,sortable:true,
				formatter: function(value,row,index){
					return value.format('yy-MM-dd hh:mm');
				}
			}
		]],
		appToolbar: [{
			iconCls: 'icon-ok',
			text:'确定',
			handler: function(){
				var grid = getDatagrid(this);
				var rows = grid.datagrid("getSelections");
				var label = $("a#<?=$_GET['label_id']?>");
				var td = label.parent();
				$.each(rows,function(i,r){
					if(td.find('a[labelId="'+r.id+'"]').size()==0){
						label.before('<a labelId="'+r.id+'" class="easyui-linkbutton l-btn l-btn-small" group="" id=""><input name="label_id[]" type="hidden" value="'+r.id+'"/><span class="l-btn-left"><span class="l-btn-text">&nbsp;'+r.name+'<span onclick="$(this).parents(\'a\').remove()">&nbsp;&nbsp;╳</span></span></span></a>&nbsp;');
					}
				});
				$(this).parents("div.window-body").dialog("close");
			}
		}]
	});
</script>